package cn.sanshuilin.kst.system.provider.bean;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author greenlee
 * @version v1.0
 * @create 创建时间: 2017-12-03 18:31
 * Copyright 2017  by 三水林科技有限公司
 **/
@Entity
@Table(name = "Dict")
public class Dict implements Serializable ,Cloneable{
    private int id;
    private String code;
    private String extension;
    private Integer isReadonly;
    private String memo;
    private String name;
    private Integer parentId;
    private Integer sequenceNo;
    private Integer statusId;

    private String parentName;
    @Transient
    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    @Id
    @Column(name = "ID", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "Code", nullable = true, length = 255)
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "Extension", nullable = true, length = 255)
    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    @Basic
    @Column(name = "IsReadonly", nullable = true)
    public Integer getIsReadonly() {
        return isReadonly;
    }

    public void setIsReadonly(Integer isReadonly) {
        this.isReadonly = isReadonly;
    }

    @Basic
    @Column(name = "Memo", nullable = true, length = 255)
    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    @Basic
    @Column(name = "Name", nullable = true, length = 255)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "ParentID", nullable = true)
    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    @Basic
    @Column(name = "SequenceNo", nullable = true)
    public Integer getSequenceNo() {
        return sequenceNo;
    }

    public void setSequenceNo(Integer sequenceNo) {
        this.sequenceNo = sequenceNo;
    }

    @Basic
    @Column(name = "StatusID", nullable = true)
    public Integer getStatusId() {
        return statusId;
    }

    public void setStatusId(Integer statusId) {
        this.statusId = statusId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Dict dictbean = (Dict) o;

        if (id != dictbean.id) return false;
        if (code != null ? !code.equals(dictbean.code) : dictbean.code != null) return false;
        if (extension != null ? !extension.equals(dictbean.extension) : dictbean.extension != null) return false;
        if (isReadonly != null ? !isReadonly.equals(dictbean.isReadonly) : dictbean.isReadonly != null) return false;
        if (memo != null ? !memo.equals(dictbean.memo) : dictbean.memo != null) return false;
        if (name != null ? !name.equals(dictbean.name) : dictbean.name != null) return false;
        if (parentId != null ? !parentId.equals(dictbean.parentId) : dictbean.parentId != null) return false;
        if (sequenceNo != null ? !sequenceNo.equals(dictbean.sequenceNo) : dictbean.sequenceNo != null) return false;
        if (statusId != null ? !statusId.equals(dictbean.statusId) : dictbean.statusId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        result = 31 * result + (extension != null ? extension.hashCode() : 0);
        result = 31 * result + (isReadonly != null ? isReadonly.hashCode() : 0);
        result = 31 * result + (memo != null ? memo.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (sequenceNo != null ? sequenceNo.hashCode() : 0);
        result = 31 * result + (statusId != null ? statusId.hashCode() : 0);
        return result;
    }

    @Override
    public Object clone(){
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            return null;
        }
    }
}
